﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using ClassDollar;
using DevExpress.DataAccess.Native.DB;
using System.Data;

namespace COMOSOFT.WareHouse_Management.Report
{
    public partial class rptExptWareHouse : DevExpress.XtraReports.UI.XtraReport
    {
        Dollar dl = new Dollar();
        System.Data.DataTable dtAmountPrice;
        double dblTTPrice = 0;
        public rptExptWareHouse(int MAEID)
        {
            InitializeComponent();
            Dataset.DataSet_WareHouseTableAdapters.MAExportMasterTableAdapter adtMT = new Dataset.DataSet_WareHouseTableAdapters.MAExportMasterTableAdapter();
            Dataset.DataSet_WareHouseTableAdapters.sp_rptOutputVoucherTableAdapter adtDT = new Dataset.DataSet_WareHouseTableAdapters.sp_rptOutputVoucherTableAdapter();
            adtMT.FillBy(this.dataSet_WareHouse1.MAExportMaster, MAEID);
            adtDT.Fill(this.dataSet_WareHouse1.sp_rptOutputVoucher, MAEID);

            dtAmountPrice = dataSet_WareHouse1.sp_rptOutputVoucher;
            for (int i = 0; i < dtAmountPrice.Rows.Count; i++)
            {
                if ((Convert.IsDBNull(dtAmountPrice.Rows[i]["Amount"]) ? "" : dtAmountPrice.Rows[i]["Amount"].ToString())!="")
                      dblTTPrice += Convert.ToDouble(dtAmountPrice.Rows[i]["Amount"]);
            }
            xrLabel_dolar.Text = "-TOTAL AMOUNT (IN WORDS): "+(dl.Convert(String.Format("{0:0.##}", dblTTPrice)) + " only./.").ToUpper();
        }
    }
}
